export default {

  install(Vue) {
    // -----------------------------------共用方法-----------------------------------

    Vue.prototype.$copy = function (value) {
      this.$copyText(
        `${value}`
      ).then(res => {
        this.$Message.success({
          background: true,
          content: '复制成功'
        });
      })
    }

    // -----------------------------------分割线以下是共用接口-----------------------------------

    Vue.prototype.$findEncode = function (item,callback) {
      this.axios({
        method: "get",
        url: "/tms/tmKnifeEncode/findEncode",
        params: {
          brevityCode:item
        }
      }).then(res => {
        if (res.code === 200) {
          if(res.data&&res.data.knifeCode){
            callback(res.data.knifeCode)
          }else{
            callback(item)
          }
        }else{
          callback(item)
        }
      })
    }
  },
}

